<template>
  <div>
        <el-table
          :data="capital"
          border
          style="width: 100%">
          <el-table-column v-for="(item,index) in capitalTit" :key="index"
            :prop="item.prop"
            :label="item.label"
            :min-width="item.width">
          </el-table-column>
        </el-table>
        <div style="margin: 30px 0;">
          <el-pagination
          @current-change="handleCurrentChange"
          :page-size="pageSize"
          layout="prev, pager, next, jumper"
          :total="total">
          </el-pagination>
        </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      id:this.$route.params.id,
      capitalTit:[{
          prop:'type',
          label:'类型',
          width: '180'
        },{
          prop:'bid1',
          label:'1月标',
          width: '180'
        },{
          prop:'bid3',
          label:'3月标',
          width: '180'
        },{
          prop:'bid6',
          label:'6月标',
          width: '180'
        },{
          prop:'bid12',
          label:'12月标',
          width: '180'
        },{
          prop:'bidGC',
          label:'工程项目',
          width: '180'
        },{
          prop:'bidZR',
          label:'转让项目',
          width: '180'
        },{
          prop:'bidCount',
          label:'投资笔数',
          width: '180'
        },{
          prop:'bidSum',
          label:'投资总额',
          width: '180'
        }
      ],
      capital:[],
      total: 0,
      pageSize: 20,
    }
  },
  methods: {
    handleCurrentChange(val) {
       this.getTableDate(val)
    },
    getTableDate (page) {
      this.$get(this,{api:'member/loadBidAll.do',data: {
        fUid:this.id,
        pageSize: this.pageSize,
        page
      }
      }).then(({data})=>{
        if (data.state === 0) {
          this.capital.push({
            type:"投标占比(100%)",
            "bidZR": Number(data.content.bidSum) !== 0 ? ((Number(data.content.bidZR)/Number(data.content.bidSum))*100).toFixed(2) +'%' : '0.00%',
            "bid6": Number(data.content.bidSum) !== 0 ? ((Number(data.content.bid6)/Number(data.content.bidSum))*100).toFixed(2) +'%' : '0.00%',
            "bid3": Number(data.content.bidSum) !== 0 ? ((Number(data.content.bid3)/Number(data.content.bidSum))*100).toFixed(2) +'%' : '0.00%',
            "bid12": Number(data.content.bidSum) !== 0 ? ((Number(data.content.bid12)/Number(data.content.bidSum))*100).toFixed(2) +'%' : '0.00%',
            "bidCount": data.content.bidCount,
            "bid1": Number(data.content.bidSum) !== 0 ? ((Number(data.content.bid1)/Number(data.content.bidSum))*100).toFixed(2) +'%' : '0.00%',
            "bidGC": Number(data.content.bidSum) !== 0 ? ((Number(data.content.bidGC)/Number(data.content.bidSum))*100).toFixed(2) +'%' : '0.00%',
            "bidSum":"100%"
          })
          data.content.type="月标投资总额"
          this.capital.push(data.content);
        } else {
          this.$toast({
            message: data.message
          })
        }
      })
    }
  },
  mounted () {
    this.getTableDate(1);
  }
}
</script>


